home *** CD-ROM | disk | FTP | other *** search
/ Aminet 37 / Aminet 37 (2000)(Schatztruhe)[!][Jun 2000].iso / Aminet / dev / lang / sofa.lha / sofa / smalleiffel / lib_se / compile_to_c.e < prev    next >
Text File  |  2000-03-25  |  5KB  |  136 lines

  1. --          This file is part of SmallEiffel The GNU Eiffel Compiler.
  2. --          Copyright (C) 1994-98 LORIA - UHP - CRIN - INRIA - FRANCE
  3. --            Dominique COLNET and Suzanne COLLIN - colnet@loria.fr
  4. --                       http://SmallEiffel.loria.fr
  5. -- SmallEiffel is  free  software;  you can  redistribute it and/or modify it
  6. -- under the terms of the GNU General Public License as published by the Free
  7. -- Software  Foundation;  either  version  2, or (at your option)  any  later
  8. -- version. SmallEiffel is distributed in the hope that it will be useful,but
  9. -- WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
  10. -- or  FITNESS FOR A PARTICULAR PURPOSE.   See the GNU General Public License
  11. -- for  more  details.  You  should  have  received a copy of the GNU General
  12. -- Public  License  along  with  SmallEiffel;  see the file COPYING.  If not,
  13. -- write to the  Free Software Foundation, Inc., 59 Temple Place - Suite 330,
  14. -- Boston, MA 02111-1307, USA.
  15. --
  16. class COMPILE_TO_C
  17.    --
  18.    -- The `compile_to_c' command.
  19.    --
  20.  
  21. inherit COMMAND_FLAGS;
  22.  
  23. creation make
  24.  
  25. feature {NONE}
  26.  
  27.    command_name: STRING is
  28.       do
  29.          Result := Command_compile_to_c;
  30.       end;
  31.  
  32.    make is
  33.       local
  34.          argc, argi: INTEGER;
  35.          arg: STRING;
  36.       do
  37.          eiffel_parser.set_drop_comments;
  38.          argc := argument_count;
  39.          if argc < 1 then
  40.             system_tools.bad_use_exit(command_name);
  41.          end;
  42.          search_for_verbose_flag;
  43.          search_for_cc_flag(argc);
  44.          from
  45.             argi := 1;
  46.          until
  47.             argi > argc
  48.          loop
  49.             arg := argument(argi);
  50.             if is_flag_case_insensitive(arg) then
  51.                argi := argi + 1;
  52.             elseif is_flag_no_style_warning(arg) then
  53.                argi := argi + 1;
  54.             elseif is_flag_no_warning(arg) then
  55.                argi := argi + 1;
  56.             elseif is_flag_version(arg) then
  57.                argi := argi + 1;
  58.             elseif is_flag_verbose(arg) then
  59.                argi := argi + 1;
  60.             elseif is_flag_boost(arg) then
  61.                argi := argi + 1;
  62.             elseif is_flag_no_check(arg) then
  63.                argi := argi + 1;
  64.             elseif is_flag_require_check(arg) then
  65.                argi := argi + 1;
  66.             elseif is_flag_ensure_check(arg) then
  67.                argi := argi + 1;
  68.             elseif is_flag_invariant_check(arg) then
  69.                argi := argi + 1;
  70.             elseif is_flag_loop_check(arg) then
  71.                argi := argi + 1;
  72.             elseif is_flag_all_check(arg) then
  73.                argi := argi + 1;
  74.             elseif is_flag_debug_check(arg) then
  75.                argi := argi + 1;
  76.             elseif is_flag_cecil(arg,argi,argc) then
  77.                argi := argi + 2;
  78.             elseif is_flag_o(arg,argi,argc,cpp) then
  79.                argi := argi + 2;
  80.             elseif ("-no_main").is_equal(arg) then
  81.                cpp.set_no_main;
  82.                argi := argi + 1;
  83.             elseif ("-no_gc").is_equal(arg) then
  84.                gc_handler.no_gc;
  85.                argi := argi + 1;
  86.             elseif ("-gc_info").is_equal(arg) then
  87.                gc_handler.set_info_flag;
  88.                argi := argi + 1;
  89.             elseif ("-no_strip").is_equal(arg) then
  90.                system_tools.set_no_strip;
  91.                argi := argi + 1;
  92.             elseif ("-no_split").is_equal(arg) then
  93.                cpp.set_no_split;
  94.                argi := argi + 1;
  95.             elseif ("-trace").is_equal(arg) then
  96.                run_control.set_trace;
  97.                argi := argi + 1;
  98.             elseif ("-wedit").is_equal(arg) then
  99.                cpp.set_wedit(true);
  100.                argi := argi + 1;
  101.             elseif Flag_cc.is_equal(arg) then
  102.                if argi < argc then
  103.                   argi := argi + 2;
  104.                else
  105.                   echo.w_put_string(command_name);
  106.                   echo.w_put_string(
  107.                      " : missing compiler name after -cc flag.%N");
  108.                   die_with_code(exit_failure_code);
  109.                end;
  110.             elseif argi < argc then
  111.                argi := system_tools.extra_arg(arg,argi,argument(argi + 1));
  112.             else
  113.                argi := system_tools.extra_arg(arg,argi,Void);
  114.             end;
  115.          end;
  116.          check_for_root_class;
  117.          if run_control.trace then
  118.             if cpp.wedit then
  119.                echo.w_put_string(command_name);
  120.                echo.w_put_string(" : cannot use -wedit with -trace flag.%N");
  121.                die_with_code(exit_failure_code);
  122.             end;
  123.             if run_control.boost then
  124.                echo.w_put_string(command_name);
  125.                echo.w_put_string(" : cannot use -trace with -boost flag.%N");
  126.                die_with_code(exit_failure_code);
  127.             end;
  128.          end;
  129.          small_eiffel.compile_to_c;
  130.          id_provider.disk_save;
  131.          string_aliaser.echo_information;
  132.       end;
  133.  
  134. end -- COMPILE_TO_C
  135.  
  136.